home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / MacMETH 3.2.4 / MacMETH Docu / LineDrawing.DEF < prev    next >
Text File  |  1996-06-20  |  6KB  |  111 lines

  1. DEFINITION MODULE LineDrawing;
  2.  
  3.   (*******************************************************************)
  4.   (*                                                                 *)
  5.   (*   Module   LineDrawing    (system library module, Version 3.0)  *)
  6.   (*                                                                 *)
  7.   (*   Purpose  Simple driver for graphics output.                   *)
  8.   (*            This module is derived from module LineDrawing       *)
  9.   (*            by Prof. Dr. N. Wirth, Institut fuer Informatik      *)
  10.   (*            ETHZ, ETH-Zentrum, CH-8092 Zuerich, SWITZERLAND,     *)
  11.   (*            designed for the Lilith computer (Version:           *)
  12.   (*            NW 15.1.82 (Lilith handbook)).                       *)
  13.   (*                                                                 *)
  14.   (*            This module provides a single drawing plane,         *)
  15.   (*            using up almost the whole output screen.  It         *)
  16.   (*            contains a two-dimensional coordinate system with    *)
  17.   (*            its origin in the lower left corner of the plane.    *)
  18.   (*                                                                 *)
  19.   (*   Remark   The current implementation is for an                 *)
  20.   (*            Apple Macintosh.  It contains a Macintosh            *)
  21.   (*            specific update mechanism (procedure Replay)         *)
  22.   (*            and has been extended by procedure mapArea           *)
  23.   (*            programmed by A.Itten.                               *)
  24.   (*                                                                 *)
  25.   (*   Programming: Alex Itten &                                     *)
  26.   (*                Andreas Fischlin                                 *)
  27.   (*                Institut Automatik und                           *)
  28.   (*                Industrielle Elektronik                          *)
  29.   (*                ETHZ,ETH-Zentrum, CH-8092 Zurich                 *)
  30.   (*                SWITZERLAND                                      *)
  31.   (*                September 1985                                   *)
  32.   (*                                                                 *)
  33.   (*   last modified:     30 March 1986                              *)
  34.   (*                                                                 *)
  35.   (*******************************************************************)
  36.   
  37.   TYPE
  38.     PaintMode = (replace, paint, invert, erase);
  39.  
  40.   VAR
  41.     Px, Py    : INTEGER;        (*current coordinates of pen,read-only*)
  42.                                 (*(0,0) = lower, left corner*)
  43.     mode      : PaintMode;      (*current mode for paint and copy and line
  44.                                 resp. lineto. read-only*)
  45.     width     : INTEGER;        (*width of picture area, read-only*)
  46.     height    : INTEGER;        (*height of picture are, read-only*)
  47.     CharWidth : INTEGER;        (*width of a character, read-only*)
  48.     CharHeight: INTEGER;        (*height of a character, read-only*)
  49.  
  50.  
  51.   PROCEDURE SetMode(mode:PaintMode);
  52.     (*set one of the four modes for dot,area,line,lineto and copyArea*)
  53.  
  54.   PROCEDURE moveto(x,y : INTEGER);
  55.     (*moves the pen without any drawing*)
  56.  
  57.   PROCEDURE dot(c: CARDINAL; x,y: INTEGER);
  58.     (*place dot in color c at coordinate (x,y). 0 = white, 1,2,3 = black
  59.     does affect the penlocation, but doesn't change the colour
  60.     (penpattern).  Dot is allways of the dimension 1 by 1*)
  61.  
  62.   PROCEDURE line(d,n: CARDINAL);
  63.     (*draw a line by moving pen by n pixels from current position
  64.     in direction d (angle = 45*d degrees). Uses the current pen mode.*)
  65.  
  66.   PROCEDURE lineto(x,y: INTEGER);
  67.     (*draw a line by moving pen from current position to new
  68.     position (x,y). Uses the current pen  mode*)
  69.  
  70.   PROCEDURE SetClipRect(x,y,w,h: INTEGER);
  71.     (*low level clip mechanism. Any Drawing outside this rectangle 
  72.     will be suppressed. x,y: lower left Point; w: width; h: height*)
  73.  
  74.   PROCEDURE area(c: CARDINAL; x,y,w,h: INTEGER);
  75.     (*paint the rectangular area at x,y of width w and height h in
  76.     color c. 0 = white, 1 = light grey, 2 = dark grey, 3 = black*)
  77.  
  78.   PROCEDURE copyArea(sx,sy,dx,dy,dw,dh: INTEGER);
  79.     (*copy rectangular area at sc,sy into rectangle at dx,dy of width
  80.     dw and height dh*)
  81.  
  82.   PROCEDURE mapArea(sx,sy,sw,sh,dx,dy,dw,dh : INTEGER);
  83.     (*maps a source area given by lower left point ( sx,sy) the width (sw)
  84.     and the height (sh) into a destination area given by  sx,sy,sw,sh.
  85.     in addition to copyArea you may change the size of your copy. *)
  86.  
  87.   PROCEDURE clear;
  88.     (*clears the screen and draws a gray outline around the lineDrawing
  89.     plane. It changes also the clipRect to the whole plane and moves 
  90.     the cursor to the center of the LineDrawing plane. The copy of 
  91.     the screen is cleared too.*)
  92.  
  93.   PROCEDURE Write(ch: CHAR);
  94.     (*write ch at pen's position; update (Px,Py) to point to the right
  95.     of ch, ready for next character. Because the colours in the PROCEDURE
  96.     area are implemented as patterns, Write and WriteString clears the needed
  97.     area before writing. *)
  98.  
  99.   PROCEDURE WriteString(s: ARRAY OF CHAR);
  100.     (*write s at pen's position; update (Px,Py) to point to the right
  101.     of s, ready for next string or character. Because the colours in the
  102.     PROCEDURE area are implemented as patterns, Write and WriteString 
  103.     clears the needed area before writing.*)
  104.  
  105.   PROCEDURE Replay;
  106.     (*calling this procedure in response to an update event, it 
  107.     restores the whole lineDrawing plane *)
  108.  
  109.  
  110. END LineDrawing.
  111.